home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / userconf / special.c < prev    next >
C/C++ Source or Header  |  1996-04-07  |  2KB  |  83 lines

  1. #include <string.h>
  2. #include "../paths.h"
  3. #include "userconf.h"
  4. #include "userconf.m"
  5.  
  6. /*
  7.     Initialise a template object for a specific group.
  8.     The caller must delete the object. It may return NULL if the
  9.     group is not special.
  10. */
  11. int special_init (const char *group, USER *&special)
  12. {
  13.     int ret = 0;
  14.     special = NULL;
  15.     if (group != NULL){
  16.         if (strcmp(group,UUCP_GROUP)==0){
  17.             /* #Specification: userconf / uucp account
  18.                 All uucp accounts are set with the
  19.                 group uucp (UUCP_GROUP)
  20.             */
  21.             int gid = group_getcreate(UUCP_GROUP
  22.                 ,MSG_U(P_UUCP,"setup UUCP account"));
  23.             if (gid != -1){
  24.                 special = new USER (NULL,NULL,-1,gid,NULL
  25.                         ,VAR_SPOOL_UUCPPUBLIC
  26.                         ,USR_LIB_UUCP_UUCICO);
  27.             }else{
  28.                 ret = -1;
  29.             }
  30.         }else if (strcmp(group,SLIP_GROUP)==0){
  31.             /* #Specification: userconf / slip account
  32.                 All slip account are set with the
  33.                 group slipusers (SLIP_GROUP)
  34.             */
  35.             int gid = group_getcreate(SLIP_GROUP
  36.                 ,MSG_U(P_SLIP,"setup SLIP account"));
  37.             if (gid != -1){
  38.                 special = new USER (NULL,NULL,-1,gid,NULL,"/tmp"
  39.                     ,SBIN_SLIPLOGIN);
  40.             }else{
  41.                 ret = -1;
  42.             }
  43.         }else if (strcmp(group,PPP_GROUP)==0){
  44.             /* #Specification: userconf / ppp account
  45.                 All ppp account are set with the
  46.                 group pppusers (PPP_GROUP). If this
  47.                 group does not exist, it is created
  48.                 The user is prompt about that.
  49.             */
  50.             int gid = group_getcreate(PPP_GROUP
  51.                 ,MSG_U(P_PPP,"setup PPP account"));
  52.             if (gid != -1){
  53.                 special = new USER (NULL,NULL,-1,gid,NULL,"/tmp"
  54.                     ,USR_LIB_PPP_PPPLOGIN);
  55.             }else{
  56.                 ret = -1;
  57.             }
  58.         }else if (strcmp(group,POP_GROUP)==0){
  59.             /* #Specification: userconf / pop account
  60.                 All pop account are set with the
  61.                 group popusers (POP_GROUP). If this
  62.                 group does not exist, it is created
  63.                 The user is prompt about that.
  64.  
  65.                 POP only users are getting the
  66.                 shell /bin/false denying
  67.                 interactive logins.
  68.             */
  69.             int gid = group_getcreate(POP_GROUP
  70.                 ,MSG_U(P_POP,"setup POP account"));
  71.             if (gid != -1){
  72.                 special = new USER (NULL,NULL,-1,gid,NULL,""
  73.                     ,"/bin/false");
  74.             }else{
  75.                 ret = -1;
  76.             }
  77.         }
  78.     }
  79.     return ret;
  80. }
  81.  
  82.  
  83.